{extend name="admin@public/content"}

{block name="content"}
<form autocomplete="off" onsubmit="return false;" action="{:request()->url()}" data-auto="true" method="post"
      class='form-horizontal layui-form padding-top-20'>

    <div class="form-group">
        <label class="col-sm-1 control-label">
            活动名称
        </label>
        <div class='col-sm-8'>
            <input name="title" required="required" title="请输入活动名称" placeholder="请输入活动名称" value="{$vo.title}"
                   class="layui-input">
            <p class="help-block">活动标题，在页面顶部显示</p>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-1 control-label">
            分享描述
        </label>
        <div class='col-sm-8'>
            <input name="sub_title" required="required" title="请输入分享描述" placeholder="请输入分享描述" value="{$vo.sub_title}"
                   class="layui-input">
            <p class="help-block">分享描述</p>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-1 control-label">
            分享logo
        </label>
        <div class='col-sm-8'>
            <img data-tips-image style="height:auto;max-height:32px;min-width:32px" src='{$vo.share_logo|default=""}'/>
            <input type="hidden" name="share_logo" onchange="$(this).prev('img').attr('src', this.value)" value='{$vo.share_logo|default=""}' class="layui-input">
            <a class="btn btn-link" data-file="one" data-uptype="cos" data-type="jpg,jpeg,png" data-field="share_logo">上传图片</a>
            <p class="help-block">尺寸：200x200px</p>
        </div>
    </div>


    <div class="form-group">
        <label class="col-sm-1 control-label label-required">
            开屏开关
        </label>
        <div class='col-sm-8'>
            <label class="think-radio">
                <input type="radio" name="kp_status" value="0" title="关闭" {if $vo.kp_status==0}checked{/if} lay-ignore>  关闭
            </label>
            <label class="think-radio">
                <input type="radio" name="kp_status" value="1" title="开启" {if $vo.kp_status==1}checked{/if} lay-ignore>  开启
            </label>
            <p class="help-block">开启后进入页面先启动开屏图。</p>
        </div>
    </div>

    <div class="form-group" data-kp_status="1">
        <label class="col-sm-1 control-label">
            开屏图
        </label>
        <div class='col-sm-8'>
            <img data-tips-image style="height:auto;max-height:32px;min-width:32px" src='{$vo.kp_pic|default=""}'/>
            <input type="hidden" name="kp_pic" onchange="$(this).prev('img').attr('src', this.value)" value='{$vo.kp_pic|default=""}' class="layui-input">
            <a class="btn btn-link" data-file="one" data-uptype="cos" data-type="jpg,jpeg,png" data-field="kp_pic">上传图片</a>
            <p class="help-block">尺寸：750x1334px</p>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-1 control-label">
            真实浏览量
        </label>
        <div class='col-sm-8'>
            <input name="view_count" readonly required="required" title="请输入真实浏览量" placeholder="请输入真实浏览量" value="{$vo.view_count}"
                   class="layui-input"  style="background: rgba(140,140,140,0.2)">
        </div>
    </div>


    <div class="form-group">
        <label class="col-sm-1 control-label">活动说明</label>
        <div class='col-sm-8'>
            <textarea name="info">{$vo.info|default=''|htmlspecialchars_decode}</textarea>
        </div>
    </div>


    <div class="form-group">
        <label class="col-sm-1 control-label">
            报名开始
        </label>
        <div class='col-sm-8'>
            <input name="regdate" id='regdate' required="required" title="请输入报名开始时间" placeholder="请输入报名开始时间"
                   value="{:date('Y-m-d H:i:s',$vo.regdate)}" class="layui-input">
            <p class="help-block">报名开始时间</p>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-1 control-label">
            报名结束
        </label>
        <div class='col-sm-8'>
            <input name="regenddate" id='regenddate' required="required" title="请输入报名结束时间" placeholder="请输入报名结束时间"
                   value="{:date('Y-m-d H:i:s',$vo.regenddate)}" class="layui-input">
            <p class="help-block">报名结束时间</p>
        </div>
    </div>


    <div class="form-group">
        <label class="col-sm-1 control-label">
            公告
        </label>
        <div class='col-sm-8'>
            <input name="notice" required="required" title="请输入公告内容" placeholder="请输入公告内容" value="{$vo.notice}"
                   class="layui-input">
            <p class="help-block">公告，在首页滚动显示</p>
        </div>
    </div>


    <div class="hr-line-dashed"></div>

    <div class="col-sm-4 col-sm-offset-2">
        <div class="layui-form-item text-center">
            <button class="layui-btn" type="submit">保存配置</button>
        </div>
    </div>

</form>
<script>

    window.laydate.render({
        range: false,
        type: 'datetime',
        elem: '#regdate'
    });

    window.laydate.render({
        range: false,
        type: 'datetime',
        elem: '#regenddate'
    });

    window.laydate.render({
        range: false,
        type: 'datetime',
        elem: '#regdate2'
    });

    window.laydate.render({
        range: false,
        type: 'datetime',
        elem: '#regenddate2'
    });

    window.laydate.render({
        range: false,
        type: 'datetime',
        elem: '#statdate'
    });

    window.laydate.render({
        range: false,
        type: 'datetime',
        elem: '#enddate'
    });

    window.laydate.render({
        range: false,
        type: 'datetime',
        elem: '#statdate2'
    });

    window.laydate.render({
        range: false,
        type: 'datetime',
        elem: '#enddate2'
    });
</script>


<script>
    (function () {
        window.form.render();
        buildForm('{$vo.kp_status}');
        $('[name=kp_status]').on('click', function () {
            buildForm($('[name=kp_status]:checked').val())
        });

        // 表单显示编译
        function buildForm(value) {
            var $tips = $("[data-kp_status='" + value + "']");
            $("[data-kp_status]").not($tips.show()).hide();
        }

    })();
</script>

<script>
    require(['jquery', 'ckeditor', 'angular'], function () {
        window.form.render();
        window.createEditor('[name="info"]', {height: 500});
        window.createEditor('[name="reginfo"]', {height: 500});
        window.createEditor('[name="about"]', {height: 500});
        var app = angular.module("ProductForm", []).run(callback);
        angular.bootstrap(document.getElementById(app.name), [app.name]);

        function callback($rootScope) {
            // 单图片上传处理
            $('#ProductForm [name="pic"]').uploadOneImage();
            // 多图片上传处理
            $('#ProductForm [name="image"]').uploadMultipleImage();

        }
    });
</script>
{/block}